<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <title>${empty teacher.teacherId ? '添加' : '编辑'}教师</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <h2>${empty teacher.teacherId ? '添加' : '编辑'}教师信息</h2>
    <form:form modelAttribute="teacher" action="/teacher/save" method="post">
        <form:hidden path="teacherId"/>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">工号</label>
            <div class="col-sm-10">
                <form:input path="teacherNo" class="form-control" required="true"/>
                <form:errors path="teacherNo" cssClass="text-danger"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">姓名</label>
            <div class="col-sm-10">
                <form:input path="name" class="form-control" required="true"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">性别</label>
            <div class="col-sm-10">
                <form:select path="gender" class="form-control">
                    <form:option value="">-- 请选择 --</form:option>
                    <form:option value="MALE">男</form:option>
                    <form:option value="FEMALE">女</form:option>
                </form:select>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">出生日期</label>
            <div class="col-sm-10">
                <form:input path="birthDate" type="date" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">职称</label>
            <div class="col-sm-10">
                <form:input path="title" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">部门</label>
            <div class="col-sm-10">
                <form:input path="department" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">联系电话</label>
            <div class="col-sm-10">
                <form:input path="phone" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">电子邮箱</label>
            <div class="col-sm-10">
                <form:input path="email" type="email" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label">入职日期</label>
            <div class="col-sm-10">
                <form:input path="hireDate" type="date" class="form-control"/>
            </div>
        </div>

        <div class="form-group row">
            <div class="col-sm-10 offset-sm-2">
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="/teacher/list" class="btn btn-secondary">取消</a>
            </div>
        </div>
    </form:form>
</div>
<script src="/static/js/jquery-3.6.0.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</body>
</html>